package com.hualan.servlet;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hualan.dao.GeneralResult;
import com.hualan.bean.PanghuCourierStation;
import com.hualan.dao.StageDao1;

import com.hualan.dao.HttpUtil;
import com.hualan.bean.PanghuCourierStation;
import com.hualan.dao.StageDao1;
import com.hualan.dao.StageDaoImpl1;
import com.hualan.dao.HttpUtil;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.LocalDateTime;



@WebServlet("/courierStation/addCourierStation")
public class StageServletAdd extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        resp.setCharacterEncoding("utf-8");
        resp.setContentType("text/html;charset=utf-8");

        //获取参数
        String courierStationName = req.getParameter("courierStationName");
        String courierStationProvince = req.getParameter("courierStationProvince");
        String courierStationCity = req.getParameter("courierStationCity");
        String courierStationDistrict = req.getParameter("courierStationDistrict");
        String courierStationAddress = req.getParameter("courierStationAddress");
        System.out.println(courierStationCity);
        //
        StageDao1 stageDao1 = new StageDaoImpl1();
        PanghuCourierStation panghuCourierStation = new PanghuCourierStation(courierStationName,courierStationProvince,courierStationCity,courierStationDistrict,courierStationAddress);
        int row = stageDao1.save(panghuCourierStation);
        System.out.println(row);
    }


    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}

